-module(ex01).
-export([start/0,print/1,stop/0, echo_loop/0]).

start() ->
    Pid = spawn_link(?MODULE, echo_loop, []),
    register(echo_server, Pid).

print(Term) ->
    echo_server ! {ok, Term}.

stop() ->
    exit(no_reason).

echo_loop() ->
    receive
	{ok, Msg} ->
	    io:format("~w~n", [Msg]),
	    echo_loop()
    end.
